<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>methods</title>
	<script src="js/vue.js"></script>
</head>
<body>
		
<div id="app">
	<button @click="fn">点击3</button>
	<button @click="fn1('8866')">点击4</button>
	<button @click="fn2(5)">点击5</button>
	<p>{{ msg }}</p>
</div>

</body>
<script>
let vm = new Vue({
	el:'#app',
	data: {
		msg: "Hello"
	},
	created: function () {
		console.log(123 + "这个方法一开始就执行。");
		this.func();
	},
	methods:{
		fn(){
			this.msg = "欢迎来到HTML中文网。";
		},
		fn1(par){
			this.msg = "参数值为：" + par;
		},
		fn2(num){
			this.msg = "计算结果：" + num * 1000;
		},
		func(num){
			console.log("这是func方法");
		}
	}
})
</script>
</html>
